load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "go_default_library",
    srcs = [
        "conversion.go",
        "interfaces.go",
        "mutation.go",
        "validation.go",
    ],
    importpath = "github.com/jetstack/cert-manager/pkg/webhook/handlers",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/internal/api/mutation:go_default_library",
        "//pkg/internal/api/validation:go_default_library",
        "//pkg/internal/apis/certmanager/validation/plugins:go_default_library",
        "//pkg/logs:go_default_library",
        "@com_github_go_logr_logr//:go_default_library",
        "@io_k8s_api//admission/v1:go_default_library",
        "@io_k8s_apiextensions_apiserver//pkg/apis/apiextensions/v1:go_default_library",
        "@io_k8s_apiextensions_apiserver//pkg/apis/apiextensions/v1beta1:go_default_library",
        "@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library",
        "@io_k8s_apimachinery//pkg/runtime:go_default_library",
        "@io_k8s_apimachinery//pkg/runtime/schema:go_default_library",
        "@io_k8s_apimachinery//pkg/runtime/serializer:go_default_library",
        "@io_k8s_apimachinery//pkg/runtime/serializer/json:go_default_library",
        "@io_k8s_apimachinery//pkg/runtime/serializer/versioning:go_default_library",
        "@io_k8s_apimachinery//pkg/util/validation/field:go_default_library",
        "@io_k8s_client_go//kubernetes:go_default_library",
    ],
)

go_test(
    name = "go_default_test",
    srcs = [
        "conversion_test.go",
        "mutation_test.go",
        "validation_test.go",
    ],
    embed = [":go_default_library"],
    deps = [
        "//pkg/internal/api/mutation:go_default_library",
        "//pkg/internal/api/validation:go_default_library",
        "//pkg/logs:go_default_library",
        "//pkg/webhook/handlers/testdata/apis/testgroup:go_default_library",
        "//pkg/webhook/handlers/testdata/apis/testgroup/install:go_default_library",
        "//pkg/webhook/handlers/testdata/apis/testgroup/v1:go_default_library",
        "//pkg/webhook/handlers/testdata/apis/testgroup/v2:go_default_library",
        "@io_k8s_api//admission/v1:go_default_library",
        "@io_k8s_apiextensions_apiserver//pkg/apis/apiextensions/v1:go_default_library",
        "@io_k8s_apiextensions_apiserver//pkg/apis/apiextensions/v1beta1:go_default_library",
        "@io_k8s_apimachinery//pkg/apis/meta/v1:go_default_library",
        "@io_k8s_apimachinery//pkg/runtime:go_default_library",
        "@io_k8s_apimachinery//pkg/types:go_default_library",
        "@io_k8s_klog_v2//klogr:go_default_library",
        "@io_k8s_utils//diff:go_default_library",
        "@xyz_gomodules_jsonpatch_v2//:go_default_library",
    ],
)

filegroup(
    name = "package-srcs",
    srcs = glob(["**"]),
    tags = ["automanaged"],
    visibility = ["//visibility:private"],
)

filegroup(
    name = "all-srcs",
    srcs = [
        ":package-srcs",
        "//pkg/webhook/handlers/testdata/apis/testgroup:all-srcs",
    ],
    tags = ["automanaged"],
    visibility = ["//visibility:public"],
)
